package org.penguin.study.bk.config

import com.baomidou.mybatisplus.annotation.DbType
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;

import org.mybatis.spring.annotation.MapperScan

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

/**
 * 增加基于MyBatisPlus的分页功能
 */
@Configuration
@MapperScan(value = ["org.penguin.study.bk.**.dao"])
class MyBatisPlusConfig {
    /**
     * 分页插件
     */
    @Bean
    fun paginationInterceptor(): MybatisPlusInterceptor {
        val interceptor = MybatisPlusInterceptor()
        interceptor.addInnerInterceptor(PaginationInnerInterceptor(DbType.MYSQL))
        return interceptor
    }
}